<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-row :gutter="10" class="queryform">
        <el-col :span="24">
        <el-form-item label="浮标" prop="buyoParams" style="width: 25%">
          <el-select v-model="buyoParams" placeholder="请选择查询的浮标" clearable>
            <el-option v-for="buyo in buyoList" :key="buyo.id" :label="buyo.buoyName"
            :value="buyo.id"></el-option>
          </el-select>
        </el-form-item>
      </el-col>
        <el-col :span="12">
        <el-form-item label="开始日期" prop="date" style="width: 50%">
        <el-date-picker clearable
          v-model="queryParams.startDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择日期">
        </el-date-picker>
      </el-form-item>
    </el-col>
    
    <el-col :span="12">
      <el-form-item label="结束日期" prop="date" style="width: 50%">
        <el-date-picker clearable
          v-model="queryParams.endDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择日期">
        </el-date-picker>
      </el-form-item>
    </el-col>

    <el-col :span="12">
      <el-form-item label="查询选项" prop="selectParams" style="width: 50%">
        <el-select v-model="selectParams" placeholder="请选择查询选项" clearable>
          <el-option v-for="dict in selectedYpInfoColumns" :key="dict.paraValue" :label="dict.paraName"
          :value="dict.paraValue"></el-option>
        </el-select>
      </el-form-item>
    </el-col>

    <el-col :span="12">
      <el-form-item label="查询数值" prop="selectValue">
        <el-input v-model="selectValue" placeholder="请输入查询值" clearable  style="width: 45%" />
        <span>&nbsp;&nbsp;至&nbsp;&nbsp;</span>
        <el-input v-model="selectEndValue" placeholder="请输入查询值" clearable  style="width: 45%" />
      </el-form-item>
    </el-col>

    <el-col :span="24">
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
        <!-- <search-condition class="search-condition" :isFullcondition.sync="isFullcondition"/> -->
      </el-form-item>
    </el-col>
    </el-row>
    </el-form>
  

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['seaTotal:seaData:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['seaTotal:seaData:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['seaTotal:seaData:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['seaTotal:seaData:export']"
        >导出</el-button>
      </el-col>
      <el-col :span="1.5">
            <el-button
              type="info"
              plain
              icon="el-icon-upload2"
              size="mini"
              @click="handleImport"
            >导入</el-button>
          </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" tableRef="table" :defaultHideColumn="[]"></right-toolbar>
    </el-row>
    <div id="tableDiv">
    <el-table v-loading="loading" :data="seaDataList"  ref="table" :height="tableHeight"  @selection-change="handleSelectionChange" :row-class-name="tableRowClassName"  border>
      <el-table-column type="selection" width="55" align="center" />
      <!-- <el-table-column label="${comment.id}" align="center" prop="id" /> -->
      <el-table-column label="日期" align="center" prop="date" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.date) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="经度" align="center" prop="longitude" />
      <el-table-column label="纬度" align="center" prop="latitude" />
      <el-table-column label="气压" align="center" prop="tenAirPressure" />
      <el-table-column label="气温" align="center" prop="tenAirTemperature" />
      <el-table-column label="湿度" align="center" prop="tenAirHumidity" />
      <el-table-column label="A风速" align="center" prop="atenWindSpeed" />
      <el-table-column label="A风向" align="center" prop="atenWindDirection" />
      <el-table-column label="B风速" align="center" prop="btenWindSpeed" />
      <el-table-column label="B风向" align="center" prop="btenWindDirection" />
      <el-table-column label="有效波高" align="center" prop="significantWavHeight" />
      <el-table-column label="有效周期" align="center" prop="validityPeriod" />
      <el-table-column label="平均波高" align="center" prop="averageWaveHeight" />
      <el-table-column label="平均周期" align="center" prop="averagePeriod" />
      <el-table-column label="波向" align="center" prop="waveDirection" />
      <el-table-column label="波数" align="center" prop="waveNumber" />
      <el-table-column label="海流水温" align="center" prop="currentWaterTemperature" />
      <el-table-column label="温盐水温" align="center" prop="warmSaltWaterTemperature" />
      <el-table-column label="独立水温" align="center" prop="independentWaterTemperature" />
      <el-table-column label="水质水温" align="center" prop="waterQualityAndTemperature" />
      <el-table-column label="盐度" align="center" prop="salinity" />
      <el-table-column label="第1层海流流速" align="center" prop="oneCurrentVelocity" />
      <el-table-column label="第2层海流流速" align="center" prop="twoCurrentVelocity" />
      <el-table-column label="第3层海流流速" align="center" prop="threeCurrentVelocity" />
      <el-table-column label="第4层海流流速" align="center" prop="fourCurrentVelocity" />
      <el-table-column label="第5层海流流速" align="center" prop="fiveCurrentVelocity" />
      <el-table-column label="第1层海流流向" align="center" prop="oneCurrentDirection" />
      <el-table-column label="第2层海流流向" align="center" prop="twoCurrentDirection" />
      <el-table-column label="第3层海流流向" align="center" prop="threeCurrentDirection" />
      <el-table-column label="第4层海流流向" align="center" prop="fourCurrentDirection" />
      <el-table-column label="第5层海流流向" align="center" prop="fiveCurrentDirection" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['seaTotal:seaData:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['seaTotal:seaData:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改海洋数据总览对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="浮标" prop="buoyId" clearable>
          <el-select v-model="form.buoyId" placeholder="请选择查询的浮标">
            <el-option v-for="buyo in buyoList" :key="buyo.id" :label="buyo.buoyName"
            :value="buyo.id"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="日期" prop="date">
          <el-date-picker clearable
            v-model="form.date"
            type="datetime"
            value-format="yyyy-MM-dd HH:mm:ss"
            placeholder="请选择日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="经度" prop="longitude">
          <el-input v-model="form.longitude" placeholder="请输入经度" />
        </el-form-item>
        <el-form-item label="纬度" prop="latitude">
          <el-input v-model="form.latitude" placeholder="请输入纬度" />
        </el-form-item>
        <el-form-item label="气压" prop="tenAirPressure">
          <el-input v-model="form.tenAirPressure" placeholder="请输入气压" />
        </el-form-item>
        <el-form-item label="气温" prop="tenAirTemperature">
          <el-input v-model="form.tenAirTemperature" placeholder="请输入气温" />
        </el-form-item>
        <el-form-item label="湿度" prop="tenAirHumidity">
          <el-input v-model="form.tenAirHumidity" placeholder="请输入湿度" />
        </el-form-item>
        <el-form-item label="A风速" prop="atenWindSpeed">
          <el-input v-model="form.atenWindSpeed" placeholder="请输入A风速" />
        </el-form-item>
        <el-form-item label="A风向" prop="atenWindDirection">
          <el-input v-model="form.atenWindDirection" placeholder="请输入A风向" />
        </el-form-item>
        <el-form-item label="B风速" prop="btenWindSpeed">
          <el-input v-model="form.btenWindSpeed" placeholder="请输入B风速" />
        </el-form-item>
        <el-form-item label="B风向" prop="btenWindDirection">
          <el-input v-model="form.btenWindDirection" placeholder="请输入B风向" />
        </el-form-item>
        <el-form-item label="有效波高" prop="significantWavHeight">
          <el-input v-model="form.significantWavHeight" placeholder="请输入有效波高" />
        </el-form-item>
        <el-form-item label="有效周期" prop="validityPeriod">
          <el-input v-model="form.validityPeriod" placeholder="请输入有效周期" />
        </el-form-item>
        <el-form-item label="平均波高" prop="averageWaveHeight">
          <el-input v-model="form.averageWaveHeight" placeholder="请输入平均波高" />
        </el-form-item>
        <el-form-item label="平均周期" prop="averagePeriod">
          <el-input v-model="form.averagePeriod" placeholder="请输入平均周期" />
        </el-form-item>
        <el-form-item label="波向" prop="waveDirection">
          <el-input v-model="form.waveDirection" placeholder="请输入波向" />
        </el-form-item>
        <el-form-item label="波数" prop="waveNumber">
          <el-input v-model="form.waveNumber" placeholder="请输入波数" />
        </el-form-item>
        <el-form-item label="海流水温" prop="currentWaterTemperature">
          <el-input v-model="form.currentWaterTemperature" placeholder="请输入海流水温" />
        </el-form-item>
        <el-form-item label="温盐水温" prop="warmSaltWaterTemperature">
          <el-input v-model="form.warmSaltWaterTemperature" placeholder="请输入温盐水温" />
        </el-form-item>
        <el-form-item label="独立水温" prop="independentWaterTemperature">
          <el-input v-model="form.independentWaterTemperature" placeholder="请输入独立水温" />
        </el-form-item>
        <el-form-item label="水质水温" prop="waterQualityAndTemperature">
          <el-input v-model="form.waterQualityAndTemperature" placeholder="请输入水质水温" />
        </el-form-item>
        <el-form-item label="盐度" prop="salinity">
          <el-input v-model="form.salinity" placeholder="请输入盐度" />
        </el-form-item>
        <el-form-item label="第1层海流流速" prop="oneCurrentVelocity">
          <el-input v-model="form.oneCurrentVelocity" placeholder="请输入第1层海流流速" />
        </el-form-item>
        <el-form-item label="第2层海流流速" prop="twoCurrentVelocity">
          <el-input v-model="form.twoCurrentVelocity" placeholder="请输入第2层海流流速" />
        </el-form-item>
        <el-form-item label="第3层海流流速" prop="threeCurrentVelocity">
          <el-input v-model="form.threeCurrentVelocity" placeholder="请输入第3层海流流速" />
        </el-form-item>
        <el-form-item label="第4层海流流速" prop="fourCurrentVelocity">
          <el-input v-model="form.fourCurrentVelocity" placeholder="请输入第4层海流流速" />
        </el-form-item>
        <el-form-item label="第5层海流流速" prop="fiveCurrentVelocity">
          <el-input v-model="form.fiveCurrentVelocity" placeholder="请输入第5层海流流速" />
        </el-form-item>
        <el-form-item label="第1层海流流向" prop="oneCurrentDirection">
          <el-input v-model="form.oneCurrentDirection" placeholder="请输入第1层海流流向" />
        </el-form-item>
        <el-form-item label="第2层海流流向" prop="twoCurrentDirection">
          <el-input v-model="form.twoCurrentDirection" placeholder="请输入第2层海流流向" />
        </el-form-item>
        <el-form-item label="第3层海流流向" prop="threeCurrentDirection">
          <el-input v-model="form.threeCurrentDirection" placeholder="请输入第3层海流流向" />
        </el-form-item>
        <el-form-item label="第4层海流流向" prop="fourCurrentDirection">
          <el-input v-model="form.fourCurrentDirection" placeholder="请输入第4层海流流向" />
        </el-form-item>
        <el-form-item label="第5层海流流向" prop="fiveCurrentDirection">
          <el-input v-model="form.fiveCurrentDirection" placeholder="请输入第5层海流流向" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>

    <!-- 用户导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        :before-remove="beforeRemove"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<style>
   .el-table .warning-row {
    background: oldlace;
  }

  .el-table .success-row {
    background: #b8c4f0;
  }
</style>
<script>
import { listSeaData, getSeaData, delSeaData, addSeaData, updateSeaData } from "@/api/seaTotal/seaData";
import { listBuoy } from "@/api/buoy/buoy";
import { getToken } from "@/utils/auth";
export default {
  name: "SeaData",
  data() {
    return {
      params: {},
      selectValue:'',
      selectEndValue:'',
      selectParams:'',
      tableHeight: '',
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 海洋数据总览表格数据
      seaDataList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 重置参数
      resutParams:{
        pageNum: 1,
        pageSize: 10
      },
      // 用户导入参数
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 设置上传的请求头部
        headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/seaTotal/seaData/importData"
      },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        startDate: null,
        endDate: null,
        longitude: null,
        latitude: null,
        tenAirPressure: null,
        tenAirTemperature: null,
        tenAirHumidity: null,
        atenWindSpeed: null,
        atenWindDirection: null,
        btenWindSpeed: null,
        btenWindDirection: null,
        significantWavHeight: null,
        validityPeriod: null,
        averageWaveHeight: null,
        averagePeriod: null,
        waveDirection: null,
        waveNumber: null,
        currentWaterTemperature: null,
        warmSaltWaterTemperature: null,
        independentWaterTemperature: null,
        waterQualityAndTemperature: null,
        salinity: null,
        oneCurrentVelocity: null,
        twoCurrentVelocity: null,
        threeCurrentVelocity: null,
        fourCurrentVelocity: null,
        fiveCurrentVelocity: null,
        oneCurrentDirection: null,
        twoCurrentDirection: null,
        threeCurrentDirection: null,
        fourCurrentDirection: null,
        fiveCurrentDirection: null,
        selectEndValue: null,
      },
       //所有选项
       selectedYpInfoColumns: [
       {
        paraValue: 'longitude',
        paraName: '经度'
        },{
        paraValue: 'latitude',
        paraName: '纬度'
        },{
        paraValue: 'tenAirPressure',
        paraName: '气压'
        },{
        paraValue: 'tenAirTemperature',
        paraName: '气温'
        },{
        paraValue: 'tenAirHumidity',
        paraName: '湿度'
        },{
        paraValue: 'atenWindSpeed',
        paraName: 'A风速'
        },{
        paraValue: 'atenWindDirection',
        paraName: 'A风向'
        },{
        paraValue: 'btenWindSpeed',
        paraName: 'B风速'
        },{
        paraValue: 'btenWindDirection',
        paraName: 'B风向'
        },{
        paraValue: 'significantWavHeight',
        paraName: '有效波高'
        },{
        paraValue: 'validityPeriod',
        paraName: '有效周期'
        },{
        paraValue: 'averageWaveHeight',
        paraName: '平均波高'
        },{
        paraValue: 'averagePeriod',
        paraName: '平均周期'
        },{
        paraValue: 'waveDirection',
        paraName: '波向'
        },{
        paraValue: 'waveNumber',
        paraName: '波数'
        },{
        paraValue: 'currentWaterTemperature',
        paraName: '海流水温'
        },{
        paraValue: 'warmSaltWaterTemperature',
        paraName: '温盐水温'
        },{
        paraValue: 'independentWaterTemperature',
        paraName: '独立水温'
        },{
        paraValue: 'waterQualityAndTemperature',
        paraName: '水质水温'
        },{
        paraValue: 'salinity',
        paraName: '盐度'
        },{
        paraValue: 'oneCurrentVelocity',
        paraName: '第1层海流流速'
        },{
        paraValue: 'twoCurrentVelocity',
        paraName: '第2层海流流速'
        },{
        paraValue: 'threeCurrentVelocity',
        paraName: '第3层海流流速'
        },{
        paraValue: 'fourCurrentVelocity',
        paraName: '第4层海流流速'
        },{
        paraValue: 'fiveCurrentVelocity',
        paraName: '第5层海流流速'
        },{
        paraValue: 'oneCurrentDirection',
        paraName: '第1层海流流向'
        },{
        paraValue: 'twoCurrentDirection',
        paraName: '第2层海流流向'
        },{
        paraValue: 'threeCurrentDirection',
        paraName: '第3层海流流向'
        },{
        paraValue: 'fourCurrentDirection',
        paraName: '第4层海流流向'
        },{
        paraValue: 'fiveCurrentDirection',
        paraName: '第5层海流流向'
        }
        ],
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      },
      buyoParams: null,
      buyoList:[]
    };
  },
  created() {
    //查询浮标
    listBuoy().then(response => {
        this.buyoList = response.rows;
        this.buyoParams=this.buyoList[0].id
      });
      //设计个倒计时查询，不然会出现找不到浮漂的数据
      setTimeout(() => {
        this.getList();
      }, 500)
    window.addEventListener("resize", this.getTableHeight)
      setTimeout(() => {
        let myEvent = new Event('resize');
        window.dispatchEvent(myEvent);
      }, 0)
  },
  updated() {
  if (this.$refs.table && this.$refs.table.doLayout) {
    this.$refs.table.doLayout();
  }
},
  methods: {
    getTableHeight() {
        this.$nextTick(() => {
          this.tableHeight = window.innerHeight - this.$refs.queryForm.$el.offsetHeight - 240;
          this.$refs.table.doLayout()
          document.getElementById("tableDiv").style.height = this.tableHeight
        })
      },
    tableRowClassName({row, rowIndex}) {      
        if ((rowIndex+1)%2 != 1) {
          return 'success-row';
        } 
        return '';
      },
    /** 查询海洋数据总览列表 selectParams为KEY，selectValue为值*/
    getList() {
      this.loading = true;
      const filterKey= Object.keys(this.queryParams).filter((element)=>element === this.selectParams)[0];
      //this.$set设置this.queryParams中filterKey属性的值为this.selectValue
      this.$set(this.queryParams, filterKey, this.selectValue)
      this.queryParams.selectEndValue=this.selectEndValue
      //查询浮漂
      this.queryParams.buoyId = this.buyoParams;
      
      // 设置 endDate 为 startDate 的日期但时间为 23:59:59
      // if(this.queryParams.endDate){
      // const endDate = new Date(this.queryParams.endDate);
      // endDate.setHours(23, 59, 59, 999);
      // this.queryParams.endDate = endDate.toISOString().split('T')[0] + ' 23:59:59';    
      // }
     
      listSeaData(this.queryParams).then(response => {
        this.seaDataList = response.rows;
        this.total = response.total;
        this.loading = false;
        this.$set(this.queryParams, filterKey, "");
        this.queryParams.selectEndValue="";
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        date: null,
        longitude: null,
        latitude: null,
        tenAirPressure: null,
        tenAirTemperature: null,
        tenAirHumidity: null,
        atenWindSpeed: null,
        atenWindDirection: null,
        btenWindSpeed: null,
        btenWindDirection: null,
        significantWavHeight: null,
        validityPeriod: null,
        averageWaveHeight: null,
        averagePeriod: null,
        waveDirection: null,
        waveNumber: null,
        currentWaterTemperature: null,
        warmSaltWaterTemperature: null,
        independentWaterTemperature: null,
        waterQualityAndTemperature: null,
        salinity: null,
        oneCurrentVelocity: null,
        twoCurrentVelocity: null,
        threeCurrentVelocity: null,
        fourCurrentVelocity: null,
        fiveCurrentVelocity: null,
        oneCurrentDirection: null,
        twoCurrentDirection: null,
        threeCurrentDirection: null,
        fourCurrentDirection: null,
        fiveCurrentDirection: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.selectValue='';
      this.selectEndValue='';      
      this.selectParams='';
      this.queryParams=this.resutParams;
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加海洋数据总览";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getSeaData(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改海洋数据总览";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateSeaData(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addSeaData(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除海洋数据总览编号为"' + ids + '"的数据项？').then(function() {
        return delSeaData(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('seaTotal/seaData/export', {
        ...this.queryParams
      }, `seaData_${new Date().getTime()}.xlsx`)
    },
    /** 导入按钮操作 */
    handleImport() {
    this.upload.title = "海洋总数据导入";
    this.upload.open = true;
  },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
    this.upload.isUploading = true;
  }, 
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
      this.getList();
    },
     // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    },
    beforeRemove(file, fileList) {
      return this.$confirm(`确定移除 ${ file.name }？`);
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download('seaTotal/seaData/importTemplate', {
      }, `sea_data_${new Date().getTime()}.xlsx`)
    },
  }
};
</script>
